/*
 * DA0.asm
 *
 *  Created: 2/9/2015 1:23:25 PM
 *   Author: smith760

 Darius Smith
 CPE301 Dr. Venki
 Assignment 1 - DA0

 */ 


 ldi r16, 38  //load a random number (38) into register 16
 ldi r17, 46  //load a random number (46) into register 17
 ldi r18, 36  //load a random number (36) into register 18
 ldi r19, 48  //load a random number (48) into register 19
 ldi r20, 58  //load a random number (58) into register 20
 ldi r21, 56  //load a random number (56) into register 21

 add r16, r17  //add contents of register 16 and 17 and store in register 16
 add r16, r18  //add contents of register 16 and 18 and store in register 16
 add r16, r19  //add contents of register 16 and 19 and store in register 16
 add r16, r20  //add contents of register 16 and 20 and store in register 16
 add r16, r21  //add contents of register 16 and 21 and store in register 16

 cpi r16, 128  //compare resulted sum (r16) with the integer 128
 brsh hi		//if same or higher than 128 then go (hi:) 
 cbi portb, 2	//clear the input bit 
 jmp done		
 hi:
 sbi portb, 2	//set the input bit high 
 done:

 sub r22, r22	// clears just so i can read the last line 